<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Class: Language
  
    &mdash; Documentation by YARD 0.7.3
  
</title>

  <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />

  <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  relpath = '';
  if (relpath != '') relpath += '/';
</script>

  <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="js/app.js"></script>


  </head>
  <body>
    <script type="text/javascript" charset="utf-8">
      if (window.top.frames.main) document.body.className = 'frames';
    </script>
    
    <div id="header">
      <div id="menu">
  
    <a href="_index.html">Index (L)</a> &raquo; 
    
    
    <span class="title">Language</span>
  
  
  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a id="class_list_link" href="#">Class List</a>
  
    <a id="method_list_link" href="#">Method List</a>
  
    <a id="file_list_link" href="#">File List</a>
  
</div>
      <div class="clear"></div>
    </div>
    
    <iframe id="search_frame"></iframe>
    
    <div id="content"><h1>Class: Language
  
  
  
</h1>

<dl class="box">
  
    <dt class="r1">Inherits:</dt>
    <dd class="r1">
      <span class="inheritName">ActiveRecord::Base</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">ActiveRecord::Base</li>
          
            <li class="next">Language</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
      </dd>
    
  
  
    
  
    
  
  
  
    <dt class="r2 last">Defined in:</dt>
    <dd class="r2 last">app/models/language.rb</dd>
  
</dl>
<div class="clear"></div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    <p>
ELMO - Secure, robust, and versatile data collection. Copyright 2011 The
Carter Center
</p>
<p>
ELMO is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
</p>
<p>
ELMO is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
</p>
<p>
You should have received a copy of the GNU General Public License along
with ELMO. If not, see &lt;http://www.gnu.org/licenses/&gt;.
</p>


  </div>
</div>
<div class="tags">
  

</div>

  


  

  
    <h2>
      Class Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#active-class_method" title="active (class method)">+ (Object) <strong>active</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#add_select_options-class_method" title="add_select_options (class method)">+ (Object) <strong>add_select_options</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#by_code-class_method" title="by_code (class method)">+ (Object) <strong>by_code</strong>(code) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#code_hash-class_method" title="code_hash (class method)">+ (Object) <strong>code_hash</strong>(options = {}) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#default-class_method" title="default (class method)">+ (Object) <strong>default</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#english-class_method" title="english (class method)">+ (Object) <strong>english</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#select_options-class_method" title="select_options (class method)">+ (Object) <strong>select_options</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#sorted-class_method" title="sorted (class method)">+ (Object) <strong>sorted</strong>(params = {}) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
    </ul>
  
    <h2>
      Instance Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#is_english%3F-instance_method" title="#is_english? (instance method)">- (Boolean) <strong>is_english?</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#name-instance_method" title="#name (instance method)">- (Object) <strong>name</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
    </ul>
  


  

  <div id="class_method_details" class="method_details_list">
    <h2>Class Method Details</h2>
    
    
      <div class="method_details first">
  <p class="signature first" id="active-class_method">
  
    + (<tt>Object</tt>) <strong>active</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


40
41
42</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/language.rb', line 40</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='active identifier id'>active</span>
  <span class='sorted identifier id'>sorted</span><span class='lparen token'>(</span><span class='symbol val'>:conditions</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='string val'>&quot;active = 1&quot;</span><span class='rparen token'>)</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="add_select_options-class_method">
  
    + (<tt>Object</tt>) <strong>add_select_options</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


46
47
48</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/language.rb', line 46</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='add_select_options identifier id'>add_select_options</span>
  <span class='LanguageList constant id'>LanguageList</span><span class='colon2 op'>::</span><span class='LANGS constant id'>LANGS</span><span class='dot token'>.</span><span class='map identifier id'>map</span><span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='code identifier id'>code</span><span class='comma token'>,</span> <span class='name identifier id'>name</span><span class='bitor op'>|</span> <span class='lbrack token'>[</span><span class='name identifier id'>name</span><span class='comma token'>,</span> <span class='code identifier id'>code</span><span class='rbrack token'>]</span><span class='rbrace token'>}</span><span class='dot token'>.</span><span class='sort_by identifier id'>sort_by</span><span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='pair identifier id'>pair</span><span class='bitor op'>|</span> <span class='pair identifier id'>pair</span><span class='lbrack token'>[</span><span class='integer val'>0</span><span class='rbrack token'>]</span><span class='rbrace token'>}</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="by_code-class_method">
  
    + (<tt>Object</tt>) <strong>by_code</strong>(code) 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


31
32
33</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/language.rb', line 31</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='by_code identifier id'>by_code</span><span class='lparen token'>(</span><span class='code identifier id'>code</span><span class='rparen token'>)</span>
  <span class='code_hash identifier id'>code_hash</span><span class='lbrack token'>[</span><span class='code identifier id'>code</span><span class='rbrack token'>]</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="code_hash-class_method">
  
    + (<tt>Object</tt>) <strong>code_hash</strong>(options = {}) 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


34
35
36
37
38
39</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/language.rb', line 34</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='code_hash identifier id'>code_hash</span><span class='lparen token'>(</span><span class='options identifier id'>options</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span>
  <span class='if if kw'>if</span> <span class='notop op'>!</span><span class='defined? defined kw'>defined?</span><span class='lparen token'>(</span><span class='@@code_hash ivar id'>@@code_hash</span><span class='rparen token'>)</span> <span class='orop op'>||</span> <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:rebuild</span><span class='rbrack token'>]</span>
    <span class='@@code_hash ivar id'>@@code_hash</span> <span class='assign token'>=</span> <span class='Hash constant id'>Hash</span><span class='lbrack token'>[</span><span class='mult op'>*</span><span class='all identifier id'>all</span><span class='dot token'>.</span><span class='collect identifier id'>collect</span><span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='l identifier id'>l</span><span class='bitor op'>|</span> <span class='lbrack token'>[</span><span class='l identifier id'>l</span><span class='dot token'>.</span><span class='code identifier id'>code</span><span class='comma token'>,</span> <span class='l identifier id'>l</span><span class='rbrack token'>]</span><span class='rbrace token'>}</span><span class='dot token'>.</span><span class='flatten identifier id'>flatten</span><span class='rbrack token'>]</span>
  <span class='end end kw'>end</span>
  <span class='@@code_hash ivar id'>@@code_hash</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="default-class_method">
  
    + (<tt>Object</tt>) <strong>default</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


49
50
51</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/language.rb', line 49</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='default identifier id'>default</span>
  <span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='symbol val'>:active</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='true true kw'>true</span><span class='rparen token'>)</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="english-class_method">
  
    + (<tt>Object</tt>) <strong>english</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


52
53
54</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/language.rb', line 52</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='english identifier id'>english</span>
  <span class='@@english ivar id'>@@english</span> <span class='opasgn op'>||=</span> <span class='find_by_code identifier id'>find_by_code</span><span class='lparen token'>(</span><span class='string val'>&quot;eng&quot;</span><span class='rparen token'>)</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="select_options-class_method">
  
    + (<tt>Object</tt>) <strong>select_options</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


43
44
45</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/language.rb', line 43</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='select_options identifier id'>select_options</span>
  <span class='sorted identifier id'>sorted</span><span class='dot token'>.</span><span class='collect identifier id'>collect</span><span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='l identifier id'>l</span><span class='bitor op'>|</span> <span class='lbrack token'>[</span><span class='l identifier id'>l</span><span class='dot token'>.</span><span class='name identifier id'>name</span><span class='comma token'>,</span> <span class='l identifier id'>l</span><span class='dot token'>.</span><span class='id identifier id'>id</span><span class='rbrack token'>]</span><span class='rbrace token'>}</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="sorted-class_method">
  
    + (<tt>Object</tt>) <strong>sorted</strong>(params = {}) 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


27
28
29
30</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/language.rb', line 27</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='sorted identifier id'>sorted</span><span class='lparen token'>(</span><span class='params identifier id'>params</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span>
  <span class='func identifier id'>func</span> <span class='assign token'>=</span> <span class='params identifier id'>params</span><span class='dot token'>.</span><span class='delete identifier id'>delete</span><span class='lparen token'>(</span><span class='symbol val'>:paginate</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='string val'>&quot;paginate&quot;</span> <span class='colon op'>:</span> <span class='string val'>&quot;find&quot;</span>
  <span class='send identifier id'>send</span><span class='lparen token'>(</span><span class='func identifier id'>func</span><span class='comma token'>,</span> <span class='symbol val'>:all</span><span class='comma token'>,</span> <span class='params identifier id'>params</span><span class='dot token'>.</span><span class='merge identifier id'>merge</span><span class='lparen token'>(</span><span class='symbol val'>:order</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='string val'>&quot;code = 'eng' desc, code&quot;</span><span class='rparen token'>)</span><span class='rparen token'>)</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>
    
    
      <div class="method_details first">
  <p class="signature first" id="is_english?-instance_method">
  
    - (<tt>Boolean</tt>) <strong>is_english?</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    

  </div>
</div>
<div class="tags">
  
<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Boolean</tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


55
56
57</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/language.rb', line 55</span>

<span class='def def kw'>def</span> <span class='is_english? fid id'>is_english?</span>
  <span class='code identifier id'>code</span> <span class='eq op'>==</span> <span class='string val'>&quot;eng&quot;</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="name-instance_method">
  
    - (<tt>Object</tt>) <strong>name</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


58
59
60</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/language.rb', line 58</span>

<span class='def def kw'>def</span> <span class='name identifier id'>name</span>
  <span class='LanguageList constant id'>LanguageList</span><span class='colon2 op'>::</span><span class='LANGS constant id'>LANGS</span><span class='lbrack token'>[</span><span class='code identifier id'>code</span><span class='dot token'>.</span><span class='to_sym identifier id'>to_sym</span><span class='rbrack token'>]</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>
    
    <div id="footer">
  Generated on Thu Dec  8 13:43:19 2011 by 
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.7.3 (ruby-1.8.7).
</div>

  </body>
</html>